import java.util.Scanner;

public class test2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long n = scanner.nextInt();
        A(n);
    }
    public static void A (long  n){
        if(n < 10) {
            return;
        }
        String arr = ""+n;
        long count = 1;
        for(int i = 0; i < arr.length(); i++) {
            if(arr.charAt(i) != '0') {
                count = count * (arr.charAt(i) - '0');
            }
        }
        System.out.println(count);
        A(count);
    }
}
